Ext.define('ES.view.archives.UsesStats',{
	extend:'Ext.container.Container',
	alias:'widget.usesstats',
	requires:['Ext.grid.Panel'],
	layout:{
		type:'vbox',
		defaultMargins:{top: 10, right: 10, bottom: 0, left: 10}
	},
	loadUsesStatsData:function(statData){
		Ext.ComponentQuery.query('grid[ESName=usesStatsGrid]')[0].getStore().loadData(statData);
	},
	initComponent:function(){
		var usesStats = Ext.create('Ext.data.Store',{
			fields:['date','views','downloads']
		})
		this.items = [
			{
				xtype:'component',
				html:'Last 4 days',
				style:{
					fontWeight:'bold',
					fontSize:12,
					color:'#6DB8E0'
				}
			},
			{
				xtype:'grid',
				flex:1,
				ESName:'usesStatsGrid',
				store:usesStats,
				width:'100%',
				emptyText:'No stats available',				
				columns:[
					{header:'Date', dataIndex:'date',flex:1},
					{header:'Views', dataIndex:'views',flex:1},
					{header:'Downloads', dataIndex:'downloads',flex:1}
				]
			}
		]
		this.callParent(arguments);
	}	
});
